#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<ll> v(n);
        ll maxgcd=0;
        for(int i=0;i<n;i++)cin>>v[i];
        for (int i=0;i<n;i++) {
            for (int j=i+1;j<n;j++) {
                ll sub=abs(v[i]-v[j]);
                for (ll d=1;d<sub*sub;d++) {
                    if (sub%d==0) {
                        maxgcd=max({maxgcd,d,sub/d});
                    }
                }
            }
        }
        cout<<maxgcd<<endl;
    }

    return 0;
}